package core;

import fileoperation.FileDeletion;
import gitobject.Blob;
import gitobject.Tree;
import repository.Repository;

import java.io.File;
import java.io.IOException;

public class JitHash {
    /**
     * Generate a hash file in .jit repository.
     * @param filename
     * @throws Exception
     */
    public static void hash(String filename) throws Exception {
        File f = new File(filename);
        if (f.isDirectory()) {
            // System.out.println("need a tree!");
            Tree tree = new Tree(f);
            tree.compressWrite();
        }
        else if (f.isFile()) {
            // System.out.println("need a blob!");
            Blob blob = new Blob(f);
            blob.compressWrite();
        }
        return;
    }
}
